<?php
include 'lib/controllerWithoutGetOrPost.php';
include 'lib/LoggedIn.php';
$loggedIn = new LoggedIn();
$loggedIn->setPermission = "Admin Area";
if(!$loggedIn->check()) {
    echo $loggedIn->message();
} else {

include("header2.php");
function listMissing($dblink) {
	$query = "SELECT `Name` FROM Publication ORDER BY `Name` ASC";
	$result = mysql_query($query, $dblink);
	// Check result
	// This shows the actual query sent to MySQL, and the error. Useful for debugging.
	if (!$result) {
		$message  = 'Invalid query: ' . mysql_error() . "\n";
	    	$message .= 'Whole query: ' . $query;
    		die($message);
	}
	$count = 0;
	while ($row = mysql_fetch_assoc($result)) {
   	if(!file_exists("/home/amemoryt/public_html/pdf/processed SWF/".$row['Name'].".pdf.swf")) {
			echo "File: ".$row['Name'].".pdf.swf is missing.<br />";
			$count++;
		}		
	}
	echo "Missing files: ".$count;	
	mysql_free_result($result);
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
listMissing($link);
echo "</body></html>";
mysql_close($link);

}
?>
